﻿/*
区域日期
fromDate，toDate：只支持文本框ID

Ex：dateRange("#dateFrom", "#dateTo");
*/
function dateRange(fromDate, toDate) {
    var dates = $("#" + fromDate + ",#" + toDate).datepicker({
        showOtherMonths: true,
        selectOtherMonths: true,
        dateFormat: 'yy-mm-dd',
        changeMonth: true,
        changeYear: true,
        defaultDate: "+1w",
        numberOfMonths: 1,
        showAnim: 'blind',
        onSelect: function (selectedDate) {
            var option = this.id == fromDate ? "minDate" : "maxDate",
					instance = $(this).data("datepicker"),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings);
            dates.not(this).datepicker("option", option, date);
        }
    });
    $("#" + fromDate + ",#" + toDate).bind("paste", function () { return false; }).forceReadOnly();
}